#pragma	once			/*  */


#include	"../Headers/types.h"			/*  */
#include	"../Headers/config.h"			/*  */
#include	"../Headers/log.h"			/*  */
#include <string>
#include <iostream>
#include <ostream>
#include <istream>
#include <fstream>

namespace TOB {
	
	/*
	 * =====================================================================================
	 *        Class:  File
	 *  Description:  Class for work with files
	 * =====================================================================================
	 */
	class File
	{
		public:
			/* ====================  LIFECYCLE     ======================================= */
			File ();                             /* constructor */
			~File ();														 /* destructor  */
			/* *
			 *	write to file
			 *	@param fileName fileName
			 *	@param data 		Writed data
			 *	@return 				Error code
			 * */
			Code::Type write(std::string fileName, std::string data);
			Code::Type write(std::string fileName, char * data, uint32 size);
			/* *
			 *	read from file
			 *	@param fileName fileName
			 *	@param data 		Readed data
			 *	@param size     Numbers of readed data (<0 - full file, >= 0 - size)
			 *	@param pos  		Stream position (=0 - begin, <0 - end, >0 - pos)
			 *	@return					Error code
			 * */
			Code::Type read(std::string fileName, std::string& source, uint16 size, uint32 pos);
			Code::Type read(std::string fileName, char * source, uint16 size, uint32 pos, uint16 * rbytes);
			/* *
			 * get file size
			 * @param fileName File Name
			 * @return				 Size of file ( =0 if file doesn't exist or file is empty )  
			 * */
			uint32 get_file_size(std::string fileName);
			/* *
			 * find string in file
			 * @param fileName file name
			 * @param s string for search
			 * @return string
			 * */
			std::string search(std::string fileName, std::string s);
			/* * 
			 * file exists
			 * @param fileName file name
			 * @return Error code
			 * */
			Code::Type exists(std::string fileName);
		private:
			/* ====================  DATA MEMBERS  ======================================= */

	}; /* -----  end of class File  ----- */

}
